package com.job.admin.audit.controller;

import com.job.admin.audit.service.AuditAvatarService;
import com.job.admin.model.audit.dto.AuditAvatarPageDto;
import com.job.client.common.result.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/admin/audit/avatar")
@Api(tags = "审核头像接口文档")
public class AuditAvatarController {
    @Autowired
    private AuditAvatarService auditAvatarService;
    @PostMapping("/list/{page}/{size}")
    @ApiOperation("获得头像审核分页数据")
    public ResponseResult getList(
            @PathVariable Integer page,
            @PathVariable Integer size,
            @RequestBody AuditAvatarPageDto dto
    ){
        return auditAvatarService.getList(page,size,dto);
    }
    @GetMapping("/userInfo")
    @ApiOperation("获得头像审核用户信息")
    public ResponseResult getUserInfo(@RequestParam String userId){
        return auditAvatarService.getUserInfo(userId);
    }
    @GetMapping("/auditSuccess")
    @ApiOperation("头像审核成功")
    public ResponseResult auditSuccess(@RequestParam String avatarId,@RequestParam String userNumber){
        return auditAvatarService.auditSuccess(avatarId,userNumber);
    }
    @GetMapping("/{avatarId}")
    @ApiOperation("通过id获得头像审核结果数据")
    public ResponseResult getAvatarResultById(@PathVariable String avatarId){
        return auditAvatarService.getAvatarResultById(avatarId);
    }
    @GetMapping("/auditError")
    @ApiOperation("头像审核失败")
    public ResponseResult auditError(
            @RequestParam String avatarId,
            @RequestParam String userNumber,
            @RequestParam String errorMessage){
        return auditAvatarService.auditError(avatarId,userNumber,errorMessage);
    }

    @GetMapping("/getAuditInfo")
    @ApiOperation("获得该用户未审核的数据")
    public ResponseResult getAuditInfo(@RequestParam String userId){
        return auditAvatarService.getAuditInfo(userId);
    }
}
